MbcsCentral Menu System

 

There are three aspects to Menu Processing

1.      The XML file that contains the menu structure.

2.      The methods in Main.cs that build the menu from the XML file.

3.      The methods in Main.cs that process menu selections.

MainWindow displays the menu.

 

1.    Menu.xml

 

This file mirrors the .Net Framework Menu class:

              Menu

                             MenuHeader

                                           MenuItem

 

The root of the file is <Menu> followed by <MenuItem> for single major categories or <MenuHeader> for multiple sub-categories.

            Basic Structure:

              <Menu>

<MenuItem Content=”Description” Name=”menuTag” Type=”actionType” Class=”class” Target=”method” Parameter=”parameters”>

                             </MenuItem>

                             <MenuHeader Content=”Description” Name=”menuTag”>

<MenuItem Content=”Description” Name=”menuTag” Type=”actionType” Class=”class” Target=”method” Parameter=”parameters”>

                                           .

                                           .

                             </MenuHeader>

            Parameters

                             Content: Description to display for MenuItem. Required.

Name: A unique value for the menuItem. Used to determine user’s permission
             and to allow multiple instances of similar items. Required.

Type:    Tells application how to handle the menuItem. Required

                             Class:    Designates a class within which to call a specified method. Optional.

                             Target: The method to call when Class is used. Only require when Class is used.

                             Parameter: Additional parameters that are needed to perform the action. These
                                                  are used by the class constructor. Can be a comma separated list
                                                   for multiple parameters. Optional.

           

 

2.    Building the menu

 

Application starts in GlobalShared.Main() which passes control to MainWindow.MainWindow_Loaded(). From there, major aspects of application start up are done by Startup. When all is determined to be ready control passes back to MainWindow.MainWindow_Loaded().

Then, Main.buildMenu() is called which reads the Menu.xml and the menu is built with the help of Main.processMenuItem (a recursive method).

 

3.    Processing the menu

 

Menu Types

Form: References a WPF window to invoke. No other parameters are required. But the
           ”Parameter” tag can be used.

1.      Method: A method set in the “Target” parm to call from the class named in the “Class” parm.

2.      Application: These are external applications that are built from the optional ExternalApplications db table.

 

Process Menu Clicks